package com.example.pkmedical.Activity.help;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.pkmedical.Base.BaseActivity;
import com.example.pkmedical.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class HelpIconActivity extends BaseActivity {

    @BindView(R.id.main_house)
    ImageView mainHouse;
    @BindView(R.id.main_house_text)
    TextView mainHouseText;
    @BindView(R.id.main_date)
    TextView mainDate;
    @BindView(R.id.icon_last_img)
    ImageView iconLastImg;
    @BindView(R.id.icon_last_finish_bt)
    Button iconLastFinishBt;
    @BindView(R.id.icon_last_nextbt)
    Button iconLastNextbt;
    @BindView(R.id.icon_last_lastbt)
    Button iconLastLastbt;
    private int now = 1;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_help_icon);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {

    }

    @Override
    public void initView() {
        mainHouse.setImageResource(R.drawable.img_top_help);
        mainHouseText.setText("帮助");
    }

    @Override
    public void initPresenter() {

    }

    @Override
    public void showDialog(String... msg) {

    }

    private void Plus() {
        if (now == 1) {
            now++;
            iconLastImg.setImageResource(R.drawable.img_help_ic_two);
            all();
        } else if (now == 2) {
            now++;
            iconLastImg.setImageResource(R.drawable.img_help_ic_three);
            all();
        } else if (now == 3) {
            now++;
            iconLastImg.setImageResource(R.drawable.img_help_ic_four);
            all();
        } else if (now == 4) {
            now++;
            iconLastImg.setImageResource(R.drawable.img_help_ic_five);
            all();
        } else if (now == 5) {
            now++;
            iconLastImg.setImageResource(R.drawable.img_help_ic_six);
            top();
        }
    }

    private void Reduce() {
        if (now == 2) {
            now--;
            iconLastImg.setImageResource(R.drawable.img_help_ic_one);
            bottom();
        } else if (now == 3) {
            now--;
            iconLastImg.setImageResource(R.drawable.img_help_ic_two);
            all();
        } else if (now == 4) {
            now--;
            iconLastImg.setImageResource(R.drawable.img_help_ic_three);
            all();
        } else if (now == 5) {
            now--;
            iconLastImg.setImageResource(R.drawable.img_help_ic_four);
            all();
        } else if (now == 6) {
            now--;
            iconLastImg.setImageResource(R.drawable.img_help_ic_five);
            all();
        }
    }

    private void top() {

        iconLastNextbt.setBackgroundResource(R.drawable.help_item_white);
        iconLastNextbt.setTextColor(getResources().getColor(R.color.color_help_text));
        iconLastLastbt.setTextColor(getResources().getColor(R.color.green_back_text));
        iconLastLastbt.setBackgroundResource(R.drawable.help_item_back_on);
    }

    private void bottom() {

        iconLastNextbt.setBackgroundResource(R.drawable.help_item_back_on);
        iconLastNextbt.setTextColor(getResources().getColor(R.color.green_back_text));
        iconLastLastbt.setBackgroundResource(R.drawable.help_item_white);
        iconLastLastbt.setTextColor(getResources().getColor(R.color.color_help_text));
    }

    private void all() {

        iconLastNextbt.setBackgroundResource(R.drawable.help_item_back_on);
        iconLastNextbt.setTextColor(getResources().getColor(R.color.green_back_text));
        iconLastLastbt.setBackgroundResource(R.drawable.help_item_back_on);
        iconLastLastbt.setTextColor(getResources().getColor(R.color.green_back_text));
    }

    @OnClick({R.id.icon_last_finish_bt, R.id.icon_last_nextbt, R.id.icon_last_lastbt})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.icon_last_finish_bt:
                finish();
                break;
            case R.id.icon_last_nextbt:
                Plus();
                break;
            case R.id.icon_last_lastbt:
                Reduce();
                break;
        }
    }
}
